<!doctype HTML>
<!-- Removing the will-change: transform on #target wil cause the canvas
to not be stacked, which means that it paints as a child of #reparent.
This exercises changing of stacking parent chain of a composited layer, at the
same time as becoming not composited.
Test passes if it does not crash. -->
<div id=reparent style="position: relative; overflow: hidden">
  <canvas id=target style='width:10px; height: 10px; will-change: transform'>
    hi
  </canvas>
</div>
<iframe id=iframe></iframe>

<script>
    if (window.testRunner) {
        window.testRunner.waitUntilDone();
        window.testRunner.dumpAsText();
    }
    onload = () => requestAnimationFrame(append);

    function append() {
        iframe.contentDocument.documentElement.appendChild(reparent);
        requestAnimationFrame(removeStacking);
    }
    function removeStacking() {
        iframe.contentDocument.querySelector("#target").style.willChange = '';
        if (window.testRunner)
            window.testRunner.notifyDone();
    }
</script>

